import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

import LoginView from '../views/login/LoginView.vue'
import EnterpriseView from '../views/enterprise/EnterpriseView.vue'
import enterpriseBackgroundView from '../views/enterprise/enterpriseBackground/enterpriseBackgroundView.vue'
import enterpriseBasicView from '../views/enterprise/enterpriseBasic/enterpriseBasicView.vue'
import enterpriseRankingView from '../views/enterprise/enterpriseRanking/enterpriseRankingView.vue'
import enterpriseExecutiveView from '../views/enterprise/enterpriseExecutive/enterpriseExecutiveView.vue'
import enterprisePatentView from '../views/enterprise/enterprisePatent/enterprisePatentView.vue'
import enterpriseTrademarkView from '../views/enterprise/enterpriseTrademark/enterpriseTrademarkView.vue'
import UserManageView from '../views/userManagement/UserManagementView.vue'
import StatisticsView from '../views/statistics/StatisticsView.vue'
import UserView from '../views/user/UserView.vue'
import InfoModifyView from '../views/user/info_modify/InfoModifyView.vue'
import PasswordModifyView from '../views/user/password_modify/PasswordModifyView.vue'
import communityView from '../views/community/communityView.vue'
import commentView from '../views/community/comment/commentView.vue'
import postView from '../views/community/post/postView.vue'
import operationStatisticsView from '../views/statistics/operationStatistics/operationStatisticsView.vue'
import queryStatisticsView from '../views/statistics/queryStatistics/queryStatisticsView.vue'
import behaviorStatisticsView from '../views/statistics/behaviorStatistics/behaviorStatisticsView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      // 重定向
      redirect: '/user-management',
      children: [
        {
          path: '/enterprise',
          name: 'enterprise',
          component: EnterpriseView,
          children: [
            {
              path: 'basic',
              name: 'basic',
              component: enterpriseBasicView,
            },
            {
              path: 'background',
              name: 'background',
              component: enterpriseBackgroundView,
            },
            {
              path: 'ranking',
              name: 'ranking',
              component: enterpriseRankingView,
            },
            {
              path: 'patent',
              name: 'patent',
              component: enterprisePatentView,
            },
            {
              path: 'trademark',
              name: 'trademark',
              component: enterpriseTrademarkView,
            },
            {
              path: 'executive',
              name: 'executive',
              component: enterpriseExecutiveView,
            },
          ],
        },
        {
          path: 'user-management',
          name: 'user-management',
          component: UserManageView,
        },
        {
          path: '/community',
          name: 'community',
          component: communityView,
          children: [
            {
              path: 'post',
              name: 'post',
              component: postView,
            },
            {
              path: 'comment',
              name: 'comment',
              component: commentView,
            },
          ],
        },
        {
          path: '/statistics',
          name: 'statistics',
          component: StatisticsView,
          children: [
            {
              path: 'behavior',
              name: 'behavior',
              component: behaviorStatisticsView,
            },
            {
              path: 'query',
              name: 'query',
              component: queryStatisticsView,
            },
            {
              path: 'operation',
              name: 'operation',
              component: operationStatisticsView,
            },
          ],
        },
      ],
    },
    {
      path: '/user',
      name: 'user',
      component: UserView,
      redirect: '/user/info_modify',
      children: [
        {
          path: 'info_modify',
          name: 'info_modify',
          component: InfoModifyView,
        },
        {
          path: 'password_modify',
          name: 'password_modify',
          component: PasswordModifyView,
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
  ],
})

export default router
